package com.mida.dms.knw.api;

import com.mida.dms.knw.entity.KnwConceptualDomain;
import com.mida.dms.knw.entity.vo.KnwCodingConceptualDomainPageVo;
import com.mida.dms.knw.entity.vo.KnwConceptualDomainVo;
import com.mida.dms.knw.entity.vo.KnwConceptualVo;
import com.mida.dms.knw.vo.PageResultVo;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.DependsOn;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @Description: 概念Api
 * @Author: wang xiao le
 * @Date: 2021/6/21 13:44
 **/
@DependsOn("loadFromDatabasePropertyConfig")
//@FeignClient(name = "knwConceptualApi", url = "${dms.knw.feign.url}")
@FeignClient(name = "knwConceptualApi", url = "dms.knw.feign.url")
public interface KnwConceptualApi {


    /**
     * 1、新增概念基本信息
     * （form）
     *
     * @param ConceptFsn         概念FSN
     * @param conceptType        概念类型
     * @param isConceptualDomain 是否有概念域
     * @param status             状态
     * @return
     */
    @PostMapping(value = "/knwConceptual/addKnwConceptual")
    ActionResult add(@RequestParam(value = "ConceptFsn") String ConceptFsn,
                     @RequestParam(value = "conceptType") Long conceptType,
                     @RequestParam(value = "isConceptualDomain") Long isConceptualDomain,
                     @RequestParam(value = "status") Long status);

    /**
     * /2、 更新概念
     * （form）
     *
     * @param conceptualSoid     概念soid
     * @param ConceptFsn         概念FSN
     * @param conceptType        概念类型
     * @param isConceptualDomain 是否有概念域
     * @param status             状态
     * @return
     */
    @PostMapping("/knwConceptual/updateKnwConceptual")
    ActionResult update(@RequestParam(value = "conceptualSoid") Long conceptualSoid,
                        @RequestParam(value = "ConceptFsn") String ConceptFsn,
                        @RequestParam(value = "conceptType") Long conceptType,
                        @RequestParam(value = "isConceptualDomain") Long isConceptualDomain,
                        @RequestParam(value = "status") Long status);
//    ActionResult update(KnwConceptualVo knwConceptualVo);

    /**
     * /3、 删除概念
     *
     * @param soid
     * @return
     */
    @GetMapping("/knwConceptual/deleteKnwConceptual")
    ActionResult delete(@RequestParam(value = "soid") long soid);


    /**
     * 4、获取概念
     *
     * @param soid
     * @return
     */
    @GetMapping("/knwConceptual/getKnwConceptual")
    ListResult<KnwConceptualVo> get(@RequestParam(value = "soid") long soid);

    /**
     * 5、概念分页查询
     *
     * @param currentPage 当前页
     * @param pageSize    每页数量
     * @param searChData  搜索关键词
     * @param conceptType 概念类型
     * @return
     */
    @PostMapping(value = "/knwConceptual/findPage")
    ListResult<PageResultVo<KnwConceptualVo>> findPage(@RequestParam(value = "currentPage") Long currentPage,
                                                       @RequestParam(value = "pageSize") Long pageSize,
                                                       @RequestParam(value = "searChData") String searChData,
                                                       @RequestParam(value = "conceptType") Long conceptType);
//    ListResult<PageResultVo<KnwConceptualVo>> findPage(KnwConceptualPageVo vo);

    /**
     * 6、查询全部概念
     *
     * @param searChData  搜索关键词
     * @param conceptType 概念类型
     * @return
     */
    @GetMapping(value = "/knwConceptual/findAll")
    ListResult<List<KnwConceptualVo>> findAll(@RequestParam(value = "searChData", required = false) String searChData,
                                              @RequestParam(value = "conceptType", required = false) Long conceptType);

    /**
     * 7、校验概念FSN重复性
     *
     * @param name 概念名称
     */
    @GetMapping(value = "/knwConceptual/checkName")
    ActionResult checkName(@RequestParam(value = "name", required = true) String name);

    /**
     * 8、概念域绑定编码体系查询
     *
     * @param conceptualSoid 概念soid
     */
    @GetMapping(value = "/knwConceptual/getKnwConceptualDomain")
    ListResult<List<KnwConceptualDomainVo>> getKnwConceptualDomain(@RequestParam(value = "conceptualSoid", required = true) long conceptualSoid);


    /**
     * 9、概念域查询所有编码体系
     *
     * @param domainSoid 概念域soid
     * @return
     */
    @GetMapping(value = "/knwConceptual/getCodingDomainAll")
    ListResult<List<KnwCodingConceptualDomainPageVo>> getCodingDomainAll(@RequestParam(value = "domainSoid", required = true) Long domainSoid);

    /**
     * 10、概念域分页查询
     *
     * @param domainSoid  概念域soid
     * @param currentPage 当前页
     * @param pageSize    每页数量
     * @return
     */
    @PostMapping(value = "/knwConceptual/getCodingDomainPage")
    ListResult<PageResultVo<KnwCodingConceptualDomainPageVo>> getCodingDomainPage(@RequestParam(value = "domainSoid") Long domainSoid,
                                                                                  @RequestParam(value = "currentPage") Long currentPage,
                                                                                  @RequestParam(value = "pageSize") Long pageSize);

//    ListResult<PageResultVo<KnwCodingConceptualDomainPageVo>> getCodingDomainPage(KnwCodingConceptualDomainVo vo);

    /**
     * 11、绑定编码体系业务处理
     *
     * @param domainSoid              概念域soid
     * @param derailCodingSystemSoids 编码体系soid集合
     * @return
     */
    @PostMapping(value = "/knwConceptual/addDerailCodingSystem")
    ActionResult addDerailCodingSystem(@RequestParam(value = "domainSoid") long domainSoid,
                                       @RequestParam(value = "derailCodingSystemSoids") String derailCodingSystemSoids);

    /**
     * 12、解绑业务处理
     *
     * @param codingDomainSoid 概念域编码体系关系SOID
     * @return
     */
    @PostMapping(value = "/knwConceptual/deleteDerailCodingSystem")
    ActionResult deleteDerailCodingSystem(@RequestParam(value = "codingDomainSoid") long codingDomainSoid);

    /**
     * 13、更新首选标识业务处理
     *
     * @param domainSoid       概念域SOID
     * @param codingDomainSoid 概念域编码体系关系SOID
     * @return
     */
    @PostMapping(value = "/knwConceptual/updateIsPreferred")
    ActionResult update(@RequestParam(value = "codingDomainSoid") long codingDomainSoid,
                        @RequestParam(value = "domainSoid") long domainSoid);

    /**
     * 14、查询所有概念域
     *
     * @return
     */
    @GetMapping(value = "/knwConceptual/getAllCodingDomain")
    ListResult<List<KnwConceptualDomain>> getAllCodingDomain();

    /**
     * 15、更新概念状态
     *
     * @param
     * @param status         状态soid
     * @param conceptualSoid 概念soid
     * @return
     */
    @GetMapping("/knwConceptual/updateStatus")
    ActionResult updateStatus(@RequestParam(value = "status") Long status,
                              @RequestParam(value = "conceptualSoid") Long conceptualSoid);

    /**
     * 16、批量上传
     *
     * @param file
     * @return
     */
    @PostMapping("/knwConceptual/uploadFile")
    @ResponseBody
    ActionResult uploadFile(@RequestPart("file") MultipartFile file);
}
